#ifndef _PREPROCESS_IL_SOURCE_H_
#define _PREPROCESS_IL_SOURCE_H_

namespace amdspl
{
    namespace fft
    {

static const CALchar * _fft_input_cs_transXY_source_=
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_cb cb0[3] \n"
"; cb0[0] - width, height, padedSize/2 \n"
"; cb0[1] - 3D transpose W,H,D (2's power) \n"
"; cb0[2] - 3D transpose W,H,D (and mask) \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(1)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000003 \n"
"; l1 = (1.401298464e-45f, 2.869859255e-42f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000001, 0x00000800, 0x00000000, 0x00000000 \n"
"mov r70.x___, vAbsTidFlat0.x \n"
"ishr r10.x___, cb0[0].x, l0.y \n"
"umod r80.x___, r70.x, r10.x \n"
"udiv r80._y__, r70.x, r10.x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0) r100, r81.xy00 \n"
"sample_resource(1)_sampler(1) r110, r81.xy00 \n"
"mov r200.xy__, r100.xyxy \n"
"mov r200.__zw, r110.xyxy \n"
"mov r201.xy__, r100.zwzw \n"
"mov r201.__zw, r110.zwzw \n"
"ishl r71.x___, r70.x, l0.y \n"
"mov r90.x___, r71.x \n"
"call 10 \n"
"mov r81.x___, r90.x \n"
"mov g[r81.x+0], r200 \n"
"iadd r90.x___, r71.x, l0.y \n"
"call 10 \n"
"mov r82.x___, r90.x \n"
"mov g[r82.x+0], r201 \n"
"endmain \n"
"func 10 \n"
"; Z = pos mod D \n"
"; X = (pos/D) mod W \n"
"; Y = (pos/D)/W mod H \n"
"; TileID = (pos/D)/W/H \n"
"; pos' = ((X+TileID*W)*H+Y)*D+Z \n"
"and r91.__z_, r90.x, cb0[2].z \n"
"ishr r90._y__, r90.x, cb0[1].z \n"
"and r91.x___, r90.y, cb0[2].x \n"
"ishr r90.__z_, r90.y, cb0[1].x \n"
"and r91._y__, r90.z, cb0[2].y \n"
"ishr r91.___w, r90.z, cb0[1].y \n"
"ishl r90.x___, r91.w, cb0[1].x \n"
"iadd r90.x___, r90.x, r91.x \n"
"ishl r90.x___, r90.x, cb0[1].y \n"
"iadd r90.x___, r90.x, r91.y \n"
"ishl r90.x___, r90.x, cb0[1].z \n"
"iadd r90.x___, r90.x, r91.z \n"
"ret \n"
"endfunc \n"
"end \n";

static const CALchar * _fft_output_cs_transXY_source_=
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_cb cb0[3] \n"
"; cb0[0].xy - width height \n"
"; cb0[0].z  - padedSize/2 \n"
"; cb0[1] - 3D transpose W,H,D (2's power) \n"
"; cb0[2] - 3D transpose W,H,D (and mask) \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000003 \n"
"; l1 = (2.802596929e-45f, 5.605193857e-45f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000002, 0x00000004, 0x00000000, 0x00000000 \n"
"mov r71.x___, vAbsTidFlat0.x \n"
"ishl r70.x___, r71.x, l0.y \n"
"mov r90.x___, r70.x \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r200, r81.xy00 \n"
"iadd r90.x___, r70.x, l0.y \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r201, r81.xy00 \n"
"mov r100.xy__, r200.xyxy \n"
"mov r110.xy__, r200.zwzw \n"
"mov r100.__zw, r201.xyxy \n"
"mov r110.__zw, r201.zwzw \n"
"mov g[r71.x+0], r100 \n"
"iadd r72.x___, r71.x, cb0[0].z \n"
"mov g[r72.x+0], r110 \n"
"endmain \n"
"func 10 \n"
"; Z = pos mod D \n"
"; X = (pos/D) mod W \n"
"; Y = (pos/D)/W mod H \n"
"; TileID = (pos/D)/W/H \n"
"; pos' = ((X+TileID*W)*H+Y)*D+Z \n"
"and r91.__z_, r90.x, cb0[2].z \n"
"ishr r90._y__, r90.x, cb0[1].z \n"
"and r91.x___, r90.y, cb0[2].x \n"
"ishr r90.__z_, r90.y, cb0[1].x \n"
"and r91._y__, r90.z, cb0[2].y \n"
"ishr r91.___w, r90.z, cb0[1].y \n"
"ishl r90.x___, r91.w, cb0[1].x \n"
"iadd r90.x___, r90.x, r91.x \n"
"ishl r90.x___, r90.x, cb0[1].y \n"
"iadd r90.x___, r90.x, r91.y \n"
"ishl r90.x___, r90.x, cb0[1].z \n"
"iadd r90.x___, r90.x, r91.z \n"
"ret \n"
"endfunc \n"
"end \n";

static const CALchar * _fft_output_cs_trans5D_source_=
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_cb cb0[3] \n"
"; cb0[0].xy - width height \n"
"; cb0[0].z  - padedSize/2 \n"
"; cb0[1] - 3D transpose W,H,D (2's power) \n"
"; cb0[2] - 3D transpose W,H,D (and mask) \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000003 \n"
"; l1 = (2.802596929e-45f, 5.605193857e-45f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000002, 0x00000004, 0x00000000, 0x00000000 \n"
"mov r71.x___, vAbsTidFlat0.x \n"
"ishl r70.x___, r71.x, l0.y \n"
"mov r90.x___, r70.x \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r200, r81.xy00 \n"
"iadd r90.x___, r70.x, l0.y \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r201, r81.xy00 \n"
"mov r100.xy__, r200.xyxy \n"
"mov r110.xy__, r200.zwzw \n"
"mov r100.__zw, r201.xyxy \n"
"mov r110.__zw, r201.zwzw \n"
"mov g[r71.x+0], r100 \n"
"iadd r72.x___, r71.x, cb0[0].z \n"
"mov g[r72.x+0], r110 \n"
"endmain \n"
"func 10 \n"
"; Z = pos mod d \n"
"; X = (pos/D) mod w \n"
"; Y = (pos/D)/W mod h \n"
"; W = (pos/D)/W/H mod b \n"
"; TileID = (pos/d)/w/b \n"
"; pos' = (((Y+TileID*h)*d+Z)*b+W)*w+X \n"
"and r91.__z_, r90.x, cb0[2].z \n"
"ishr r90._y__, r90.x, cb0[1].z \n"
"and r91.x___, r90.y, cb0[2].x \n"
"ishr r90.__z_, r90.y, cb0[1].x \n"
"and r91._y__, r90.z, cb0[2].y \n"
"ishr r90.___w, r90.z, cb0[1].y \n"
"and r91.___w, r90.w, cb0[2].w \n"
"ishr r92.x___, r90.w, cb0[1].w \n"
"ishl r90.x___, r92.x, cb0[1].x \n"
"iadd r90.x___, r90.x, r91.x \n"
"ishl r90.x___, r90.x, cb0[1].w \n"
"iadd r90.x___, r90.x, r91.w \n"
"ishl r90.x___, r90.x, cb0[1].z \n"
"iadd r90.x___, r90.x, r91.z \n"
"ishl r90.x___, r90.x, cb0[1].y \n"
"iadd r90.x___, r90.x, r91.y \n"
"ret \n"
"endfunc \n"
"end \n";

    }
}

#endif // _PREPROCESS_IL_SOURCE_H_